<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<div>
<div id="carts_content_div">
	 <input type="hidden" value="${synchronizeCookieStr}" id="synchronizeCookieStr" />
	 <div class="gwc" style=" margin:auto;padding-bottom:20px;">
		<div id="empty_tip_div" style="padding-top:20px;background:#fff;display:${(cartItems== null || fn:length(cartItems) == 0)?'':'none'} ">
		     <div id="main" >
		       <div class="gwc_k">
		         <img src="${staticPath}/images/empty-cart.png" />
		         <P>购物车空空的，去寻找心仪的宝贝吧~</P>
		         <input onclick="javascript:gotoHtml('/index.htm')" type="button" name="" style="cursor: pointer;" value="去逛逛" />
		       </div>
		     </div> 
	    </div>
		<table id="th_table" cellpadding="0" cellspacing="0" class="gwc_tb1" style="display: ${(cartItems!= null && fn:length(cartItems) > 0)?'':'none'}">
			<tr>
				<td class="tb1_td1"><input id="Checkbox1" type="checkbox"  class="allselect all_check"/></td>
				<td class="tb1_td1">全选</td>
				<td class="tb1_td3">商品</td>
				<td class="tb1_td5">数量</td>
				<td class="tb1_td6">价格</td>
				<td class="tb1_td7">操作</td>
			</tr>
		</table>
	<c:set var="storageId" value="-1"  />
	<c:forEach items="${cartItems}" var="item">
		  <c:if test="${item.goods.storage.id!=storageId}">
		    <table cellpadding="0" cellspacing="0" class="gwc_tb2" id="storage_table${item.goods.storage.id}">
				<tr>
					<td class="tb1_td1" style="float:left;text-align:left; width:auto;height:30px;line-height:30px;">
						<input id="storage${item.goods.storage.id}"  name="storage" value="${item.goods.storage.id}" type="checkbox"  class="allselect"/> ${item.goods.storage.name}
					</td>
				</tr>
			</table>
			<c:set var="storageId" value="${item.goods.storage.id}"  />
		  </c:if>
	     <input type="hidden" id="goods_price${item.sku.id}" value="${item.goodsPrice}"/>
	     <input type="hidden" id="goods_id${item.sku.id}" value="${item.goods.id}"/>
		<table cellpadding="0" cellspacing="0" class="gwc_tb2" id="sku_div${item.sku.id}">
			<tr>
				<td class="tb2_td1"><input type="checkbox" ${item.isBuy==1?"checked='checked'":""} value="${item.sku.id}"  name="cart_item${storageId}" id="newslist-1" /></td>
				<td class="tb2_td2"><a href="javascript:toGoodsDetail(this,'${item.sku.id}');"><img src="${item.goodsImage}" alt="" /></a></td>
				<td class="tb2_td3"><a href="javascript:toGoodsDetail(this,'${item.sku.id}');">${item.goodsName}${item.sku.specName}</a><br/><span style="color:grey;">${item.sku.specName}</span></td>
				<td class="tb1_td5">
					<input id="min1" class="goods_num_change"  style=" width:20px; height:18px;border:1px solid #ccc;" type="button" value="-" />
					<input type="text" id="goods_num${item.sku.id}" name="goods_num${item.sku.id}" value="${item.goodsNum}"  class="goods_num"  style=" width:30px; text-align:center; border:1px solid #ccc;" />
					<input id="add1" class="goods_num_change" style=" width:20px; height:18px;border:1px solid #ccc;" type="button" value="+" />
				</td>
				<td class="tb1_td6">
					<label id="goods_total${item.sku.id}"  class="tot" style="color:#ff5500;font-size:14px; font-weight:bold;">￥<fmt:formatNumber value="${item.goodsPrice*item.goodsNum/100}" pattern="0.00"/></label>
				</td>
				<td class="tb1_td7"><a href="javascript:void(0);" class="del_cart_a" id="del_cart_a${item.sku.id}">删除</a></td>
			</tr>
		</table>
	</c:forEach>
		<table id="count_table" cellpadding="0" cellspacing="0" class="gwc_tb3" style="display:${(cartItems== null || fn:length(cartItems) == 0)?'none':''}">
			<tr>
				<td class="tb1_td1"><input id="all_check" class="allselect all_check" type="checkbox" /></td>
				<td class="tb1_td1" colspan="2" style="text-align: left;"><span >全选</span> <span id="delCartItems" style="margin-left: 10px;cursor: pointer;">删除选中的商品</span></td>
				<td class="tb3_td2" >已选商品 <label id="goods_total_num" style="color:#ff5500;font-size:14px; font-weight:bold;">0</label> 件</td>
				<td class="tb3_td3" >合计(不含运费):<span style=" color:#ff5500;"><span>￥</span><label id="total_cost" style="color:#ff5500;font-size:14px; font-weight:bold;"></label></span></td>
				<td class="tb3_td4">
					<a href="javascript:void(0)" class="jz2" id="to_preorder">结算</a>
				</td>
			</tr>
		</table>
	</div>
</div>
</div>	
